Package-level declarations

Types

Link copied to clipboard
@Serializable
@SerialName(value = "assistant")
open class AssistantMessage(val content: String?, val name: String? = null, val prefix: Boolean? = null, val reasoningContent: String? = null) : ChatMessage

Assistant-role message — either a prior model response replayed as context, or a prefix-completion seed for the deepseek-chat prefix mode.

Link copied to clipboard
@Serializable
class BalanceInfo(val currency: CurrencyType, val totalBalance: String, val grantedBalance: String, val toppedUpBalance: String)

Per-currency balance breakdown returned inside a UserBalance.

Link copied to clipboard
@Serializable
class ChatChoice(val finishReason: FinishReason, val index: Long, val message: ChatCompletionMessage, val logprobs: LogProbs? = null)

One completion alternative returned inside a ChatCompletion.

Link copied to clipboard
@Serializable
class ChatChoiceChunk(val delta: ChatCompletionDelta, val finishReason: FinishReason?, val index: Long, val logprobs: LogProbs? = null)

One choice slice carried by a streamed ChatCompletionChunk.

Link copied to clipboard
@Serializable
class ChatCompletion(val id: String, val choices: List<ChatChoice>, val created: Long, val model: String, val systemFingerprint: String? = null, val object: String, val usage: Usage)

Represents the Chat Completion.

Link copied to clipboard
@Serializable
class ChatCompletionChunk(val id: String, val choices: List<ChatChoiceChunk>, val created: Long, val model: String, val systemFingerprint: String? = null, val object: String, val usage: Usage? = null)

One chunk of a streamed chat completion response.

Link copied to clipboard
@Serializable
class ChatCompletionDelta(val role: String? = null, val content: String? = null, val reasoningContent: String? = null, val toolCalls: List<ToolCallDelta>? = null)

A chat completion delta generated by streamed model responses.

Link copied to clipboard
@SerialName(value = "assistant")
class ChatCompletionMessage(content: String?, reasoningContent: String? = null, val toolCalls: List<ToolCall>? = null) : AssistantMessage

Assistant-role message as returned by the DeepSeek API inside a ChatChoice.

Link copied to clipboard

Custom serializer for ChatCompletionMessage that enforces the assistant role on the wire and omits null tool_calls fields from the output.

Link copied to clipboard

Forces the model to call a specific tool.

Link copied to clipboard

Parameters for configuring chat completion requests to DeepSeek models.

Link copied to clipboard
@Serializable
class ChatCompletionRequest(val messages: List<ChatMessage>, val model: ChatModel, val frequencyPenalty: Double? = null, val maxTokens: Int? = null, val presencePenalty: Double? = null, val responseFormat: ResponseFormat? = null, val stop: StopReason? = null, val stream: Boolean? = null, val streamOptions: StreamOptions? = null, val temperature: Double? = null, val topP: Double? = null, val tools: List<Tool>? = null, val toolChoice: ToolChoice? = null, val logprobs: Boolean? = null, val topLogprobs: Int? = null, val thinking: Thinking? = null)

Represents the Chat Completion request

Link copied to clipboard

Coarse tool-selection strategy.

Link copied to clipboard
@Serializable
sealed interface ChatMessage

One turn in a chat conversation.

Link copied to clipboard

Identifier of a DeepSeek chat model.

Link copied to clipboard
@Serializable
class CompletionTokenDetails(val reasoningTokens: Int)

Breakdown of how the completion_tokens count in Usage was spent.

Link copied to clipboard

Currency used to denominate a BalanceInfo entry.

Link copied to clipboard
open class DeepSeekParams

Shared sampling parameters for the DeepSeek chat and FIM endpoints.

Link copied to clipboard
@Serializable
class FIMChoice(val text: String, val index: Int, val finishReason: FinishReason? = null, val logprobs: FIMLogProbs? = null)

One completion alternative returned inside a FIMCompletion.

Link copied to clipboard
@Serializable
class FIMCompletion(val id: String, val choices: List<FIMChoice>, val created: Long, val model: String, val systemFingerprint: String? = null, val object: String, val usage: Usage? = null)

Response payload of a Fill-In-the-Middle completion.

Link copied to clipboard

Parameters for configuring Fill-in-the-Middle (FIM) completion requests to DeepSeek models.

Link copied to clipboard
@Serializable
class FIMCompletionRequest

Represents the FIM (Fill-In-the-Middle) Completion request

Link copied to clipboard
@Serializable
class FIMLogProbs(val textOffset: List<Int>, val tokenLogprobs: List<Double>, val tokens: List<String>, val topLogprobs: List<Map<String, Double>>? = null)

Log-probability information attached to a FIMChoice.

Link copied to clipboard
@Serializable
enum FinishReason : Enum<FinishReason>

Reason the model stopped producing tokens for a ChatChoice or FIMChoice.

Link copied to clipboard
@Serializable
class FunctionDelta(val name: String? = null, val arguments: String? = null)

A partial function call carried inside a ToolCallDelta.

Link copied to clipboard
@Serializable
class FunctionRequest(val name: String, val description: String?, val parameters: JsonObject?) : ToolFunction

Function signature declared in a chat completion request.

Link copied to clipboard
@Serializable
class FunctionResponse(val name: String, val arguments: JsonObject?) : ToolFunction

Function invocation emitted by the model inside a ToolCall.

Link copied to clipboard
@Serializable
class ListsModels(val object: String, val data: List<ModelInfo>)

Response payload of org.oremif.deepseek.api.models — a list of DeepSeek models available to the current API key.

Link copied to clipboard
@Serializable
class LogProb(val token: String, val logprob: Double, val bytes: List<Int>?, val topLogprobs: List<TopLogProb>)

Log-probability information for a single chat-completion token.

Link copied to clipboard
@Serializable
class LogProbs(val content: List<LogProb>? = null, val reasoningContent: List<LogProb>? = null)

Log-probability information attached to a ChatChoice or ChatChoiceChunk.

Link copied to clipboard
@Serializable
class ModelInfo(val id: String, val object: ModelObjectType, val ownedBy: String)

Metadata for a single DeepSeek model entry returned by org.oremif.deepseek.api.models.

Link copied to clipboard
@Serializable
enum ModelObjectType : Enum<ModelObjectType>

Discriminator value returned in the object field of a ModelInfo entry.

Link copied to clipboard
@Serializable
class PromptTokensDetails(val cachedTokens: Int? = null)

Breakdown of the prompt tokens counted by Usage, returned by the API under the prompt_tokens_details key.

Link copied to clipboard
@Serializable
class ResponseFormat

Format the model must use for its response.

Link copied to clipboard
@Serializable(with = StopReasoningSerializer::class)
class StopReason(val reasons: List<String>)

Custom stop sequences that cause the model to stop generating further tokens.

Link copied to clipboard
@Serializable
class StreamOptions(val includeUsage: Boolean)

Represents options that can be applied to a streaming request.

Link copied to clipboard
@Serializable
@SerialName(value = "system")
class SystemMessage(val content: String, val name: String? = null) : ChatMessage

System-role message — sets the assistant's behavior for the rest of the conversation.

Link copied to clipboard
@Serializable
class Thinking(val type: ThinkingType)

Toggles the reasoning ("thinking") pass of the deepseek-reasoner model.

Link copied to clipboard
@Serializable
enum ThinkingType : Enum<ThinkingType>

Values accepted by Thinking.type.

Link copied to clipboard
@Serializable
class Tool(val type: ToolCallType, val function: FunctionRequest)

Declaration of a tool the model may call during a chat completion.

Link copied to clipboard
@Serializable
class ToolCall(val id: String, val type: ToolCallType, val function: FunctionResponse)

A tool invocation emitted by the model inside a ChatCompletionMessage.

Link copied to clipboard
@Serializable
class ToolCallDelta(val index: Int, val id: String? = null, val type: ToolCallType? = null, val function: FunctionDelta? = null)

An incremental tool call update sent in a streaming chat completion response.

Link copied to clipboard
@Serializable
enum ToolCallType : Enum<ToolCallType>

Type discriminator for a tool that the model can call.

Link copied to clipboard
@Serializable(with = ToolChoiceSerializer::class)
sealed interface ToolChoice

Controls how the model picks a tool to call.

Link copied to clipboard
@Serializable(with = ToolFunctionSerializer::class)
sealed interface ToolFunction

A function referenced by a tool.

Link copied to clipboard
@Serializable
@SerialName(value = "tool")
class ToolMessage(val content: String, val toolCallId: String) : ChatMessage

Tool-role message — the result of executing a ToolCall produced by the model.

Link copied to clipboard
@Serializable
class TopLogProb(val token: String, val logprob: Double, val bytes: List<Int>?)

One of the top alternatives considered at a given token position in LogProb.topLogprobs.

Link copied to clipboard
@Serializable
class Usage(val completionTokens: Int, val promptTokens: Int, val promptCacheHitTokens: Int? = null, val promptCacheMissTokens: Int? = null, val promptTokensDetails: PromptTokensDetails? = null, val totalTokens: Int, val completionTokensDetails: CompletionTokenDetails? = null)

Token usage statistics for a single chat or FIM request.

Link copied to clipboard
@Serializable
class UserBalance(val isAvailable: Boolean, val balanceInfos: List<BalanceInfo>)

Snapshot of the current user's account balance, as returned by org.oremif.deepseek.api.userBalance.

Link copied to clipboard
@Serializable
@SerialName(value = "user")
class UserMessage(val content: String?, val name: String? = null) : ChatMessage

User-role message — the end-user's input to the conversation.

Functions

Link copied to clipboard

Creates chat completion parameters using a builder pattern.

Link copied to clipboard

Creates streaming chat completion parameters using a builder pattern.

Link copied to clipboard

Creates FIM completion parameters using a builder pattern.

Link copied to clipboard

Creates streaming FIM completion parameters using a builder pattern.